package com.verlet.springbootdemo.simple.disruptor.netty.server;

import com.verlet.springbootdemo.simple.disruptor.netty.AbstractMessageConsumer;
import com.verlet.springbootdemo.simple.disruptor.netty.TranslatorData;
import com.verlet.springbootdemo.simple.disruptor.netty.TranslatorDataWapper;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MessageConsumerImpl extends AbstractMessageConsumer {
    public MessageConsumerImpl(String consumerId) {
        super(consumerId);
    }

    @Override
    public void onEvent(TranslatorDataWapper event) throws Exception {
        TranslatorData translatorData = event.getTranslatorData();
        log.info(translatorData.toString());

        translatorData.setMessage("回应数据");
        event.getChannelHandlerContext().writeAndFlush(translatorData);
    }
}
